import {
  IptPropsConstType,
  CommonIptOptionsConst,
  CommonSwitchIptTextConst, CommonIptPropValConst,
} from '@config'
import {RoleObjPropNameEnum} from '../enums/role-obj-prop-name-enum.ts'
import {RoleIptLimit} from './role-ipt-limit.ts'

/**
 * 与角色相关的输入组件 placeholder 常量
 */
export const RoleIptProps: IptPropsConstType = {
  id: {
    formItem: {label: '角色 ID', path: RoleObjPropNameEnum.ID},
    ipt: {
      placeholder: '请输入角色 ID',
      allowInput: CommonIptPropValConst.allowInput.onlyNumber,
    },
  },
  name: {
    formItem: {label: '角色名称', path: RoleObjPropNameEnum.NAME},
    ipt: {
      placeholder: '请输入角色名称',
      maxlength: RoleIptLimit.NAME_MAX_LEN,
      allowInput: CommonIptPropValConst.allowInput.noSideSpace,
    },
  },
  code: {
    formItem: {label: '角色编码', path: RoleObjPropNameEnum.CODE},
    ipt: {
      placeholder: '请输入角色编码',
      maxlength: RoleIptLimit.CODE_MAX_LEN,
      allowInput: CommonIptPropValConst.allowInput.noSideSpace,
    },
  },
  disabled: {
    switch: {
      formItem: {label: '角色状态', path: RoleObjPropNameEnum.DISABLED},
      ipt: {
        size: 'medium',
        ...CommonSwitchIptTextConst.enabled
      },
    },
    select: {
      formItem: {label: '是否禁用', path: RoleObjPropNameEnum.DISABLED},
      ipt: {
        placeholder: '请选择禁用状态',
        options: CommonIptOptionsConst.disabled,
      },
    }
  },
  sort: {
    formItem: {label: '角色排序', path: RoleObjPropNameEnum.SORT},
    ipt: {
      placeholder: '请输入角色排序',
      min: 0,
      max: Number.MAX_SAFE_INTEGER,
      allowInput: CommonIptPropValConst.allowInput.onlyNumber,
    },
  },
  remark: {
    formItem: {label: '备注', path: RoleObjPropNameEnum.REMARK},
    ipt: {
      type: 'textarea',
      placeholder: '请输入角色备注',
      maxlength: RoleIptLimit.REMARK_MAX_LEN,
      showCount: true,
      autosize: { minRows: 3, maxRows: 6 },
      allowInput: CommonIptPropValConst.allowInput.noSideSpace,
    } as Record<string, any>,
  }
}
